{% extends 'student_management/base.html' %}

{% block content %}
<div class="card">
    <div class="card-header">
        {% if form.instance.pk %}
        <h3>编辑学生信息</h3>
        {% else %}
        <h3>添加新学生</h3>
        {% endif %}
    </div>
    <div class="card-body">
        <form method="post">
            {% csrf_token %}
            {% for field in form %}
            <div class="mb-3">
                <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                {{ field.errors }}
                {{ field }}
            </div>
            {% endfor %}
            <button type="submit" class="btn btn-primary">保存</button>
            <a href="{% url 'student-list' %}" class="btn btn-secondary">返回</a>
        </form>
    </div>
</div>
{% endblock %} 